#!/bin/sh

uci -q batch <<-EOT
	delete firewall.natcapd
	set firewall.natcapd=include
	set firewall.natcapd.type=script
	set firewall.natcapd.path=/usr/share/natcapd/firewall.include
	set firewall.natcapd.family=any
	set firewall.natcapd.reload=1
	commit firewall
EOT

uci -q batch <<-EOF >/dev/null
	delete ucitrack.@natcapd[-1]
	add ucitrack natcapd
	set ucitrack.@natcapd[-1].init=natcapd
	commit ucitrack
EOF

test -f /etc/openvpn/natcap-ta.key || {
	mkdir -p /etc/openvpn
	openvpn --genkey --secret /etc/openvpn/natcap-ta.key
}

exit 0
